//
//  UIView+Frame.m
//
//  Created by yanli on 16/5/28.
//  Copyright © 2016年 yanli. All rights reserved.
//

#import "UIView+Frame.h"

@implementation UIView (Frame)
#pragma mark -- x
- (CGFloat)x
{
    return self.frame.origin.x;
}

- (void)setX:(CGFloat)x
{
    //获取
    CGRect rect = self.frame;
    //修改
    rect.origin.x = x;
    //赋值
    self.frame = rect;
}

#pragma mark -- y
- (CGFloat)y{
    
    return self.frame.origin.y;
}


- (void)setY:(CGFloat)y{
    
    CGRect rect = self.frame;
    rect.origin.y = y;
    self.frame = rect;
}

#pragma mark -- width
- (CGFloat)width{
    
    return self.frame.size.width;
}


- (void)setWidth:(CGFloat)width{
    
    CGRect rect = self.frame;
    rect.size.width = width;
    self.frame = rect;
}


#pragma mark -- height
- (CGFloat)height{
    
    return self.frame.size.height;
}


- (void)setHeight:(CGFloat)height{
    
    CGRect rect = self.frame;
    rect.size.height = height;
    self.frame = rect;
}


#pragma mark -- centerX
- (CGFloat)centerX{
    
    return self.center.x;
}


- (void)setCenterX:(CGFloat)centerX{
    
    CGPoint center = self.center;
    center.x = centerX;
    self.center = center;
    
}


#pragma mark -- centerY
- (CGFloat)centerY{
    
    return self.center.y;
}


- (void)setCenterY:(CGFloat)centerY{
    
    CGPoint center = self.center;
    center.y = centerY;
    self.center = center;
    
}


#pragma mark -- size
- (CGSize)size{
    
    return self.size;
}


- (void)setSize:(CGSize)size{
    
    CGSize s = self.size;
    s = size;
    self.size = s;
    
}


@end













